#ifdef a
#include<stdio.h>
#include<string.h>
int main() {
	char arr_before[20] = { 0 };//被替换字符串
	char arr_after[20] = { 0 };//替换字符串
	char input[200] = { 0 };//输入行
	char myput[400] = { 0 };//输出
	int flag = 0;
	scanf("%s", arr_before);
	scanf("%s", arr_after);
	getchar();
	gets(input);
	char* point_input = input;
	char* point_before = NULL;
	char* point_after = NULL;
	char* point_put = myput;
	while (*point_input) {
		flag = 0;
		point_after = arr_after;
		point_before = arr_before;
		if (*point_input && *point_before == *point_input || (*point_before - 32) == *point_input || (*point_before + 32) == *point_input) {
			//大小写无关查询
			char* temp = point_input;
			while (*point_input && *point_before == *point_input || (*point_before - 32) == *point_input || (*point_before + 32) == *point_input) {
				point_before++;
				point_input++;
				if (!(*point_before)) {
					flag = 1;
					break;
				}
			}
			if (flag) {
				while (*point_after) {
					*point_put++ = *point_after++;
				}
			}
			else {
				point_input = temp;
				*point_put++ = *point_input++;
			}
			//if (flag) 
			//	strcat(myput, arr_after);
		}
		else {
			*point_put++ = *point_input++;
		}
	}
	puts(myput);
	return 0;
}

#endif
